<?php
use app\common\middleware\AllowCrossDomain;
use app\common\middleware\AuthCheckToken;
use think\facade\Route;

Route::group(function () {
    Route::post('sendCode', 'Login/sendVerifyCode');
    Route::post('phoneLogin', 'Login/phoneLogin');
    Route::post('login', 'Login/login');
    Route::get('captcha', 'Login/verify');
    Route::post('log/login', 'live.Log/addLoginErrorLog');

})->middleware([AllowCrossDomain::class]);

Route::group('member', function () {
    Route::get('loginout', 'Login/logout');
    Route::get('clear', 'Login/clear');
    Route::get('/info', 'system.Member/info');
    Route::post('/add', 'system.Member/add');
    Route::post('/index', 'system.Member/index');
    Route::get('/del', 'system.Member/del');
    Route::post('/edit', 'system.Member/edit');
    Route::get('/findMemberRole', 'system.Member/findMemberRole');
    Route::post('/getShopList', 'system.Member/getShopList');

})->middleware([AllowCrossDomain::class, AuthCheckToken::class]);



Route::group('menu', function () {
    Route::get('/router', 'system.Menu/getRouter');
    Route::get('/tree', 'system.Menu/menuTree');
    Route::post('/add', 'system.Menu/add');
    Route::post('/edit', 'system.Menu/edit');
    Route::get('/changeStatus', 'system.Menu/changeStatus');
    Route::post('/changeOrder', 'system.Menu/changeOrder');
    Route::get('/del', 'system.Menu/del');
})->middleware([AllowCrossDomain::class, AuthCheckToken::class]);

Route::group('role', function () {
    Route::post('/index', 'system.Role/index');
    Route::post('/add', 'system.Role/add');
    Route::get('/del', 'system.Role/del');
    Route::post('/edit', 'system.Role/edit');
    Route::get('/selectRoleMenuId', 'system.Role/selectRoleMenuId');
    Route::get('/changeStatus', 'system.Menu/changeStatus');
    Route::post('/changeOrder', 'system.Menu/changeOrder');
    Route::get('/selectRole', 'system.Role/selectRole');
})->middleware([AllowCrossDomain::class, AuthCheckToken::class]);

Route::group('files', function () {
    Route::post('/addset', 'files.Fileset/add');
    Route::get('/indexset', 'files.Fileset/index');
    Route::post('/index', 'files.Files/index');
    Route::get('/del', 'files.Files/del');
    Route::post('/batchRemove', 'files.Files/batchRemove');
})->middleware([AllowCrossDomain::class, AuthCheckToken::class]);

Route::rule('Uploads/index', 'Upload/uploads')
    ->middleware([AllowCrossDomain::class, AuthCheckToken::class]);
Route::rule('UploadsBook/index', 'UploadBook/uploads')
    ->middleware([AllowCrossDomain::class, AuthCheckToken::class]);
